// IpAccessStatesShowUserGroupDlg.cpp: implementation of the CIpAccessStatesShowUserGroupDlg class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "IpAccessStatesShowUserGroupDlg.h"

#include "eDASexpressApp.h"
#include "KUserList.h"

extern CEDASexpressApp theApp;

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CIpAccessStatesShowUserGroupDlg::CIpAccessStatesShowUserGroupDlg(const CString &strGroupName, CWnd* pParent /*=NULL*/)
	: CIpAccessStatesShowDlg(strGroupName, pParent)
{
}

CIpAccessStatesShowUserGroupDlg::~CIpAccessStatesShowUserGroupDlg()
{

}

CStringItemsArray CIpAccessStatesShowUserGroupDlg::GetRoles(const CString &strGroupName)
{
	CStringItemsArray &arrDefaultRoles= GetGroupDefaultRoles( strGroupName );
return (arrDefaultRoles);
}

CStringItemsArray CIpAccessStatesShowUserGroupDlg::GetGroupDefaultRoles(const CString &strGroupName)
{
	if (strGroupName.IsEmpty())
		return (CString());
	
	int iGroupIndex= -1;
	CListCtrl &clstUserGrouop= theApp.m_pMainDlg->m_KUser.m_clstUserGroup;
	const int iGroupCnt= clstUserGrouop.GetItemCount();
	for (int i= 0; i < iGroupCnt; i++)
	{
		CString &strName= clstUserGrouop.GetItemText( i, KUserList::COLNO_USERGROUP_NAME );
		if (strGroupName == strName)
		{
			iGroupIndex = i;
			break;
		}
	}
	
	CString &strDefaultRoles = clstUserGrouop.GetItemText( iGroupIndex, KUserList::COLNO_USERGROUP_ROLE );
	CStringItemsArray arrDefaultRoles(strDefaultRoles);

return (arrDefaultRoles);
}
